package com.wkk.nursinghome.dao;


import com.wkk.nursinghome.domain.Bedstaff;
import com.wkk.nursinghome.domain.Employee;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface IBedstaffDao {
    //根据编号查询员工信息
    @Select("select * from bedstaff where id=#{id}")
    public Bedstaff selectBedstaffById(Integer id);

    //查询所有员工信息
    @Select("select * from bedstaff order by id asc")
    public List<Bedstaff> selectAll();

    //添加员工信息
    @Insert("insert into bedstaff (fnumber,name, sex,stusetime,enusetime,bedtails) " +
            "values (#{fnumber},#{name}, #{sex},#{stusetime}, #{enusetime},#{bedtails})")
    @SelectKey(statement = "select LAST_INSERT_ID()",keyProperty = "id",before = false,resultType = Integer.class)
    public int insertBedstaff(Bedstaff bedstaff);

    //删除员工信息
    @Delete("delete from bedstaff where id=#{id}")
    public int deleteBedstaffById(Integer id);

    //修改员工信息
    @UpdateProvider(type = BedstaffSQLProvider.class,method = "updateBedstaff")
    public int updateBedstaff(Bedstaff bedstaff);

    //根据条件查询员工信息
    @SelectProvider(type = BedstaffSQLProvider.class,method = "selectBedstaffByCondition")
    public List<Bedstaff> getBedstaffByCondition(Bedstaff bedstaff);
}
